﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class uc_public : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CreatePublicShow();


    }

    private void CreatePublicShow()
    {


        string sql = string.Format("SELECT top 10 * FROM [pollution] where [p_state]='{0}'", 1);
        ManageData md = new ManageData(util.DATACONNECTION);
        if (md != null)
        {
            DataSet ds = md.ExecDS(sql);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                string ret = string.Empty;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {

                      ret += "<tr>";
                      ret += string.Format(@"<td class='loginfont'><a href='detail.aspx?id={0}' target='_blank'>[处理情况公布]关于{1}处理结果已经处理过程公示....</a></td>", ds.Tables[0].Rows[i]["p_id"],ds.Tables[0].Rows[i]["p_name"]);
                           
                        ret += "</tr>";

                }

                Label1.Text = ret;
            }
        }




        //string sql = string.Format("SELECT top 10 * FROM [pollution] where [p_state]='{0}'", 1);
        //ManageData md = new ManageData(util.DATACONNECTION);
        //if (md != null)
        //{
        //    DataSet ds = md.ExecDS(sql);
        //    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        //    {
        //        string ret = string.Empty;
        //        for (int i = 0; i < ds.Tables[0].Rows.Count; )
        //        {

        //            ret += "<tr>";
        //            ret += string.Format("<td width='50%'><a href='detail.aspx?id={0}' target='_blank'><img src='./upload/{1}' width='100%' /></a></td>", ds.Tables[0].Rows[i]["p_id"], ds.Tables[0].Rows[i]["p_img"]);
        //            if ((i + 1) < ds.Tables[0].Rows.Count)
        //            {
        //                ret += string.Format("<td width='50%'><a href='detail.aspx?id={0}' target='_blank'><img src='./upload/{1}' width='100%' /></a></td>", ds.Tables[0].Rows[i+1]["p_id"],ds.Tables[0].Rows[i + 1]["p_img"]);
                       
        //            }
        //            ret += "</tr>";
        //            ret += "<tr>";
        //            ret += string.Format(" <td>{0}</td>", ds.Tables[0].Rows[i]["p_name"]);
                 
        //            if ((i+1) < ds.Tables[0].Rows.Count)
        //            {
        //                ret += string.Format(" <td>{0}</td>", ds.Tables[0].Rows[i+1]["p_name"]);
                      
        //            }
        //            i++;
        //            i++;

        //            ret += "</tr>";
        //        }

        //        Label1.Text = ret;
        //    }
       // }

    }
}
